package k1_exercise;

public class Array_exercise_first {

    /**
     * 定义一个10个元素组成的一维数组
     * int[] array= {1,25,7,8,9,0,56,90,78,100};
     * 求该数组中的最大值和最小值,以及平均值
     */
    public static void main(String[] args) {

        int[] array= {1,25,7,8,9,0,56,90,78,100};

        int maxNumber = 0;
        int minNumber = array[0];
        int sum = 0;

        for (int num : array) {

            if(num>maxNumber){
                maxNumber = num;
            }else if(num<minNumber){
                minNumber = num;
            }

            sum+=num;
        }
        System.out.println("max:"+maxNumber+",min:"+minNumber+",avg:"+(sum/ array.length));
    }

}
